package com.joy.service;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

public class UserService {


    /**
     * 用户注册
     * @param username
     * @param password
     * @return
     */
    public boolean addUser(String username, String password) {
        String SQL="select userid from user where username=?";
        Integer result = Db.queryFirst(SQL, username);
        if (result == null) {
            Record user = new Record().set("username", username)
                    .set("password", password);
            Db.save("user", user);
            return true;
        }else{
            return false;
        }
    }
}
